package com.lanou3g.code0409.common;

import java.util.Scanner;

/**
 * If there are no bugs, it was created by Chen FengYao on 2018/4/9;
 * Otherwise, I don't know who created it either
 */

public class TestString02 {
    public static void main(String[] args) {
        String s = "Hello"; //new

        Scanner scanner = new Scanner(System.in);
        String line = scanner.nextLine();
        System.out.println(line == s);

        // 判断对象类型的相等,永远不要使用 ==
        // == 只能用来判断基本数据类型是否相等
        // 判断两个对象是否相等 使用 equals方法
        // 所有对象都有这个方法
        System.out.println(s.equals(line));


//        String s1 = "Hello";//new


//        String s2 = new String("Hello");
//        System.out.println(s);
//        System.out.println(s1);
//        System.out.println(s2);
//
//        System.out.println(s == s1);
//        System.out.println(s == s2);
//        System.out.println(s1 == s2);
    }
}
